﻿#pragma once
#include <string>
#include <vector>

/****************************************************创建型方式 建造者******************************************************/

class Product1
{
public:
    std::vector<std::string> parts_;
    void ListParts() const;
};

class Product2
{
public:
    std::vector<std::string> parts_;
    void ListParts() const;
};

class Builder
{
public:
    virtual ~Builder() {}
    virtual void producePartA() const = 0;
    virtual void producePartB() const = 0;
    virtual void producePartC() const = 0;
};

class ConcreteBuilder1 : public Builder
{
private:
    Product1 *product;

public:
    ConcreteBuilder1();
    ~ConcreteBuilder1();

    void reset();

    void producePartA() const override;
    void producePartB() const override;
    void producePartC() const override;

    Product1 *GetProduct();
};

class ConcreteBuilder2 : public Builder
{
private:
    Product2 *product;

public:
    ConcreteBuilder2();
    ~ConcreteBuilder2();

    void reset();

    void producePartA() const override;
    void producePartB() const override;
    void producePartC() const override;

    Product2 *GetProduct();
};

class Director
{

private:
    Builder *builder;

public:
    void set_builder(Builder *builder);

    void buildMinimalViableProduct();
    void buildFullFeaturedProduct();
};